home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Fonts / FontSize.h < prev    next >
Encoding:
Text File  |  1997-06-28  |  1.3 KB  |  52 lines  |  [TEXT/CWIE]

  1. // FontSize.h
  2.  
  3. #ifndef FontSize_h
  4. #define FontSize_h
  5.  
  6. #ifndef Integers_h
  7. #include "Integers.h"
  8. #endif
  9. #ifndef Assert_h
  10. #include "Assert.h"
  11. #endif
  12.  
  13. class FontSize
  14.   {
  15.     private:
  16.         uint16 size;
  17.     
  18.         FontSize( uint16 value )
  19.           : size( value )
  20.           {}
  21.         
  22.     public:
  23.         uint16 Value() const                            { return size; }
  24.         
  25.         static FontSize Make( uint16 );
  26.         static FontSize Default();
  27.         
  28.         static FontSize Smallest()                    { return 1; }
  29.         static FontSize Largest()                    { return maxint16; }
  30.         
  31.         FontSize operator++()                        { Assert( size < maxint16 ); return ++size; }    
  32.         FontSize operator++(int)                    { Assert( size < maxint16 ); return size++; }
  33.         
  34.         FontSize operator--()                        { Assert( size > 1 ); return --size; }    
  35.         FontSize operator--(int)                    { Assert( size > 1 ); return size--; }
  36.         
  37.         void operator+=( int16 d );
  38.         void operator-=( int16 d );
  39.         
  40.         FontSize operator+( int16 d ) const;
  41.         FontSize operator-( int16 d ) const;
  42.         
  43.         bool operator==( FontSize f ) const        { return size == f.size; }
  44.         bool operator!=( FontSize f ) const        { return size != f.size; }
  45.         bool operator>=( FontSize f ) const        { return size >= f.size; }
  46.         bool operator<=( FontSize f ) const        { return size <= f.size; }
  47.         bool operator>( FontSize f ) const        { return size > f.size; }
  48.         bool operator<( FontSize f ) const        { return size < f.size; }
  49.   };
  50.  
  51. #endif
  52.